from flask import Flask,render_template
from utils import *
app = Flask(__name__)

@app.route("/")
def index():
    deal_amount = get_deal_amount()
    month_data = get_per_month_deal_amount()
    compare_data = compare_last_month_deal_amount()
    age_data = get_visitor_arrtibute(6,11)
    educate_data = get_visitor_arrtibute(14,17)
    view_count_data = get_views_and_visitor_count('浏览量')
    visitor_count_data = get_views_and_visitor_count('访客数')
    per_day_deal_amount = get_per_day_deal_amount()
    additional_deal_data = get_additional_deal_data()
    map_data = get_map_data()
    wb = load_workbook('数据汇总.xlsx',data_only=True)
    composite_data = get_composite_data(wb)
    return render_template('index.html',deal_amount=deal_amount[:5],month_data=month_data,compare_data=compare_data,age_data=age_data,educate_data=educate_data,view_count_data=view_count_data,visitor_count_data=visitor_count_data,per_day_deal_amount=per_day_deal_amount,additional_deal_data=additional_deal_data,map_data=map_data,composite_data=composite_data)

if __name__ == '__main__':
    app.run(debug=True)